package com.wanmait.gohome.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.gohome.mapper.LogSheetMapper;
import com.wanmait.gohome.pojo.LogSheet;
import com.wanmait.gohome.pojo.Userinfo;
import com.wanmait.gohome.service.LogSheetService;
import com.wanmait.gohome.util.SysContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class LogSheetServiceImpl implements LogSheetService {

    @Resource
    LogSheetMapper logSheetMapper;

    @Override
    public void insert(LogSheet logSheet) {
        logSheetMapper.insert(logSheet);
    }

    @Override
    public void update(Integer id) {

    }

    @Override
    public void delete(Integer id) {

    }

    @Override
    public void delete(String ids) {

    }

    @Override
    public List<LogSheet> findAll() {
        return null;
    }

    @Override
    public LogSheet findById(Integer id) {
        return null;
    }

    @Override
    public PageInfo<LogSheet> findPage() {
        int pageNum= SysContext.getPageNum();
        int pageSize=10;
        try {
            //pageSize = Integer.parseInt();//数据库里取
        } catch (NumberFormatException e) {
            pageSize=10;
        }

        PageHelper.startPage(pageNum,pageSize);//pageSize

        List<LogSheet> info    = logSheetMapper.findAll();
        PageInfo<LogSheet> pageInfo = new PageInfo<>(info,7);

        return pageInfo;

    }

    @Override
    public List<LogSheet> findAll(LogSheet object) {
        return null;
    }

    @Override
    public PageInfo<LogSheet> findPage(LogSheet Object) {
        return null;
    }
}
